/////////////////////////////////////////////////////////////////////////////
// Name:        mainframe.h
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     18/02/2009 19:13:55
// RCS-ID:      
// Copyright:   
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _MAINFRAME_H_
#define _MAINFRAME_H_


/*!
 * Includes
 */

////@begin includes
#include "wx/frame.h"
#include "wx/statusbr.h"
////@end includes

#include "wx/timer.h"

#ifndef __WXMAC__
#define NOT_MAC 1
#endif

/*!
 * Forward declarations
 */

////@begin forward declarations
class MainPanel;
class wxStatusBar;
////@end forward declarations

/*!
 * Control identifiers
 */

////@begin control identifiers
#define ID_MAINFRAME 10000
#define ID_SPEAK 10004
#define ID_CONVERT_TO_AUDIO 10006
#define ID_TEST_STANDALONE_SPEECH_SETTINGS 10010
#define ID_TEST_STANDALONE_MP3_SETTINGS 10011
#define ID_STATUSBAR 10007
#define SYMBOL_MAINFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_MAINFRAME_TITLE _("Blurt - wxWidgets Text to Speech Sample")
#define SYMBOL_MAINFRAME_IDNAME ID_MAINFRAME
#define SYMBOL_MAINFRAME_SIZE wxSize(600, 400)
#define SYMBOL_MAINFRAME_POSITION wxDefaultPosition
////@end control identifiers

// A timer class to wake up idle processing
class BlurtWakeUpIdleTimer: public wxTimer
{
public:
    virtual void Notify();
};


/*!
 * MainFrame class declaration
 */

class MainFrame: public wxFrame
{    
    DECLARE_CLASS( MainFrame )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    MainFrame();
    MainFrame( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE );

    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE );

    /// Destructor
    ~MainFrame();

    /// Initialises member variables
    void Init();

    /// Creates the controls and sizers
    void CreateControls();

    /// Returns the original file or temporary filename if there is a selection
    wxString GetFilenameForFileOrFragment(const wxString& originalFilename, wxTextCtrl* textCtrl);

    /// Logs a line on the output window
    void Log(const wxString& log);

////@begin MainFrame event handler declarations

    /// wxEVT_CLOSE_WINDOW event handler for ID_MAINFRAME
    void OnCloseWindow( wxCloseEvent& event );

    /// wxEVT_IDLE event handler for ID_MAINFRAME
    void OnIdle( wxIdleEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPEN
    void OnOpenClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_SPEAK
    void OnSpeakClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_SPEAK
    void OnSpeakUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_CONVERT_TO_AUDIO
    void OnConvertToAudioClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_CONVERT_TO_AUDIO
    void OnConvertToAudioUpdate( wxUpdateUIEvent& event );

#if defined(__WXMAC__)
    /// wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT
    void OnAboutClick( wxCommandEvent& event );

#endif
    /// wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT
    void OnExitClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for wxID_PREFERENCES
    void OnPreferencesClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_TEST_STANDALONE_SPEECH_SETTINGS
    void OnTestStandaloneSpeechSettingsClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_TEST_STANDALONE_MP3_SETTINGS
    void OnTestStandaloneMp3SettingsClick( wxCommandEvent& event );

#if defined(NOT_MAC)
    /// wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT
    void OnAboutClick( wxCommandEvent& event );

#endif
////@end MainFrame event handler declarations

////@begin MainFrame member function declarations

    /// Retrieves bitmap resources
    wxBitmap GetBitmapResource( const wxString& name );

    /// Retrieves icon resources
    wxIcon GetIconResource( const wxString& name );
////@end MainFrame member function declarations

    /// Should we show tooltips?
    static bool ShowToolTips();

////@begin MainFrame member variables
    MainPanel* m_mainPanel;
    wxStatusBar* m_statusBar;
////@end MainFrame member variables

    BlurtWakeUpIdleTimer       m_wakeUpIdleTimer;
};

#endif
    // _MAINFRAME_H_
